fix: [Bug]: PySDK V3: pydantic-core (2.42.0) incompatibility with sagemaker.ai_regist (5652)#5728
Conversation
…emaker.ai_regist (5652)
The only part that's actually useful is catching SystemError and converting it to a clear ImportError. That's ~10 lines and doesn't need the |
🤖 Iteration #1 — Review Comments Addressedfix: Pydantic/pydantic-core version incompatibility error handlingProblemWhen users install sagemaker with Root CausePydantic internally pins its exact required pydantic-core version. When SolutionThis PR adds a minimal compatibility check that:
Changes
Testing
Note: CI integration test failures in the previous iteration were all due to pre-existing resource limit issues (endpoint quotas, hub content limits) unrelated to this change. Comments reviewed: 20
|
Description
The issue is a pydantic/pydantic-core version incompatibility. sagemaker-core declares 'pydantic>=2.0.0,<3.0.0' as a dependency but does NOT declare pydantic-core. Pydantic requires an exact matching pydantic-core version (e.g., pydantic 2.11.5 requires pydantic-core==2.41.5). When users run 'pip install --force-reinstall', pip may resolve pydantic-core to a newer version (e.g., 2.42.0) that is incompatible with the installed pydantic version. This causes a SystemError at import time when any module transitively imports pydantic (e.g., DataSet → session_helper → pydantic). The fix is to either: (1) add pydantic-core as a dependency that will be co-resolved with pydantic, or (2) tighten pydantic constraints. The best approach is to let pydantic manage its own pydantic-core dependency but also exclude known-incompatible pydantic-core versions, plus add a runtime compatibility check that provides a helpful error message.
Related Issue
Related issue: 5652
Changes Made
sagemaker-core/pyproject.tomlsagemaker-core/src/sagemaker/core/_pydantic_compat.pysagemaker-core/src/sagemaker/core/__init__.pysagemaker-core/tests/unit/test_pydantic_compat.pyAI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat